home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
MATH
/
VLN_20
/
SQRTOF2.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-03-30
|
2KB
|
103 lines
Program MiscOps; { find roots }
uses wincrt, windos, lnk23;
const ln10ln2 = 3.3219; { exponent multiplier for 2^n vs 10^n}
{$I vlnconst.inc}
var
i, key : integer;
CountMax,StdVLNSize : integer;
a, b, c, d, e, f, qt, er, rm : integer; { pointers to the numbers }
m, n, p, q : integer;
longLSB : longint;
vlnGroup : array[0..99] of integer;
Done : boolean;
{=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\}
procedure WriteHexReg( r : integer; S : String );
const HexA : String =('0123456789ABCDEF');
var c, i, n : integer;
S1 : String[6];
w : word;
begin
Write(S);
c := getcount(r);
while c>0 do
begin
w := GetWord(r,c);
dec(c);
S1 := '- -';
for i := 1 to 4 do
begin
n := w and $F;
w := w shr 4;
S1[6-i] := HexA[n+1];
end;
write(' ',c,'>',S1,' ');
if (c mod 4 = 0) then writeln;
end;
end;
{=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\}
procedure WriteReg( r : integer; S : String );
var
mplyer : integer;
begin
mplyer := 0;
Write(S);
if getcount(r) > 0 then
write ( '[',mplyer,']',DivByBillion(r):9,' ' );
while getcount(quotient) > 0 do begin
{ quotient is put into this reg }
inc(mplyer,9);
if (mplyer mod 36 = 0) then
begin
writeln;
write(' >>');
end;
write ( '[',mplyer,']',DivByBillion(quotient):9,' ' );
end;
writeln;
end;
{=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\}
{ Main }
{=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\}
var itr, fst, loop, sgn : integer;
begin
Randomize;
OpenTempRegs;
CountMax := Getwksize div 4; { set count to anyvalue <= wksize }
StdVLNSize := CountMax*2+6; {these variables need this much storage }
c:= 36; d := 49;
Number_Op(c,SetSmall,2);
Number_Op(d,TenNth,100);
Register_Op(c,MulBy,d);
WriteReg(c,' - ');
writeln( ' 2.000...000 { 100 digits }' );
Number_Op(c,NthRoot,2);
WriteReg(c,' - ');
writeln( '1.414.... { 50 digits } ');
writeln('--------------------------------');
writeln('Done!');
CloseTempRegs;
end.